﻿using System;
using System.Collections.Generic;
using System.Text;
using WindowsLive.Writer.Api;
using System.Windows.Forms;
using LiveWriterMp3Player.Properties;

namespace LiveWriterMp3Player
{
    [WriterPlugin("73b9e9b4-12dd-4907-a6fa-d97ddb32e7e9", "Insert MP3 player", 
        Description = "Inserts a small, minimalist, Flash-based MP3 player.", 
        ImagePath="musicalNote.png",
        PublisherUrl="http://judahgabriel.blogspot.com")]
    [InsertableContentSourceAttribute("MP3 player")]
    public class Mp3Player : ContentSource
    {
        public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content)
        {
            using (var dialog = new InsertMp3Dialog())
            {
                dialog.ShowDialog();

                if (dialog.DialogResult == DialogResult.OK)
                {
                    content = string.Format(Resources.FlashPlayerHtmlSnippet, dialog.PlayerUrl, dialog.PlayerWidth, dialog.PlayerHeight, dialog.Url);
                }
                return dialog.DialogResult;
            }
        }
    }
}
